package cn.itsy.dao.position;

import cn.itsy.pojo.Dept;
import cn.itsy.pojo.Duct;
import cn.itsy.pojo.EmpJobDuctEmpstatus;
import cn.itsy.pojo.Job;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/***
 * sj
 * 2019/5/27
 *人事管理
 */
@Repository
public class EmpJobDuctEmpstatusDaoIml implements EmpJobDuctEmpstatusDao {
    @Resource
    private JdbcTemplate jdbctem;

    /**
     * sj
     * 查询方法Emp，job，duct，empstatus表
     *
     * @param sql
     * @return
     */
    @Override
    public List<EmpJobDuctEmpstatus> selectEmpJobDuctEmpstatusShow(String sql) {
        List<EmpJobDuctEmpstatus> query = jdbctem.query(sql, new BeanPropertyRowMapper<EmpJobDuctEmpstatus>(EmpJobDuctEmpstatus.class));
        return query;
    }

    /**
     * 查询部门dept表
     *
     * @param sql
     * @return
     */
    @Override
    public List<Dept> selectDeptShow(String sql) {
        List<Dept> listDept = jdbctem.query(sql, new BeanPropertyRowMapper<Dept>(Dept.class));

        return listDept;
    }

    /**
     * 查询dupt表
     *
     * @param sql
     * @return
     */
    @Override
    public List<Duct> selectDuctShow(String sql) {
        List<Duct> listDuct = jdbctem.query(sql, new BeanPropertyRowMapper<Duct>(Duct.class));

        return listDuct;
    }

    /**
     * 查询Job表
     *
     * @param sql
     * @return
     */
    @Override
    public List<Job> selectJobShow(String sql) {
        List<Job> listJob = jdbctem.query(sql, new BeanPropertyRowMapper<Job>(Job.class));
        return listJob;
    }


    /**
     * sj
     * 添加辞职历史纪录
     * emphistory表
     */
    @Override
    public void insertEmpHistoryShow(String sql) {
        jdbctem.update(sql);
    }

    /**
     * sj
     * 修改在职换成辞职
     * 修改emp表
     */
    @Override
    public void updateEmpHistoryShow(String sql) {
        jdbctem.update(sql);
    }

}
